<?php

namespace addon\hotel\admin\controller;

use app\admin\controller\BaseAdmin;
use addon\hotel\model\Config as ConfigModel;

class Config extends BaseAdmin
{

    public function agreement()
    {
        if (request()->isAjax()) {
            //设置注册协议
            $title = input('title', '');
            $content = input('content', '');
            $config_model = new ConfigModel();
            return $config_model->setSettledInDocument($title, $content);
        } else {
            //获取注册协议
            $config_model = new ConfigModel();
            $document_info = $config_model->getSettledInDocument();
            $this->assign('document_info', $document_info);

            return $this->fetch('config/agreement');
        }
    }

}